/*                   _   _ _ __                               *\
**     ________ ___ | | | | '_ \   scaup - Scala up!          **
**    / __/ __// _ || | | | |_) |  (c) 2008, Normen Mueller   **
**  __\ \/ /__/ __ || |_| | .__/   http://kwarc.info.nmueller **
** /____/\___/_/ |_/ \__,_|_|                                 **
**                                                            **
\*                                                            */
  
// $Id: IOUtil.scala 10 2008-05-24 15:10:30Z normen.mueller $

package scaup.io

import java.io.{IOException, FileNotFoundException}
import java.io.{File => JFile}
import java.nio.charset._

//@deprecated
object IOUtil {  
  
  def lsR(path: JFile, suffix: String): Iterable[JFile] = path.listFiles match {    
    case fs: Array[JFile] => fs.elements.foldLeft(Set.empty[JFile])((s: Set[JFile], f: JFile) => {
      if(f.isDirectory) s++lsR(f,suffix)
      else if(f.isFile && f.getName.endsWith(suffix)) s+f
      else s })
    case _ => Iterable.empty
  }
}
